<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .content {
        width: 200px;
        height: 200px;
        background-color: orange;
        position: relative;
      }

      .child {
        width: 50px;
        height: 50px;
        background-color: palegoldenrod;
        position: absolute;

        /* 方案1 */
        left: 50%;
        top: 50%;
        margin-left: -25px;
        margin-top: -25px;

        /* 方案2 */
        /* left: 0;
        right: 0;
        bottom: 0;
        top: 0;
        margin: auto; */

        /* 方案3 */
        /* left: 50%;
        top: 50%;
        transform: translate(-50%, -50%); */
      }
    </style>
  </head>
  <body>
    <div class="content">
      <div class="child"></div>
    </div>
  </body>
</html>
